package cn.icanci.task.controller;

import cn.icanci.task.service.JavaMailBy163Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.mail.MessagingException;

/**
 * @Author: icanci
 * @ProjectName: Spring-Boot-Cases
 * @PackageName: cn.icanci.task.controller
 * @Date: Created in 2020/7/18 12:41
 * @ClassAction: 邮件测试类
 */
@RestController
public class EmailController {
    @Autowired
    private JavaMailBy163Service javaMailBy163Service;

    @GetMapping("/mail")
    public String mail() {
        javaMailBy163Service.sendMail("hello icanci");
        return "邮件1发送成功";
    }

    @GetMapping("/mail2")
    public String mail2() throws MessagingException {
        javaMailBy163Service.sendMoreMail("这个是一个测试邮件");
        return "邮件2发送成功";
    }
}
